﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="WebApplication01.Login" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="css1/StyleSheet1.css" rel="stylesheet" />
    <script src="Scripts/jquery-1.10.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#Login").on("click", function () {
                var aUser = $("#username").val();
                var aPwd = $("#password").val();
                if (aUser.length != 0 && aPwd.length != 0) {
                    $.ajax({
                        type: "get",
                        url: "AssetHandel/LoginHandler.ashx",
                        data: { user: aUser, pwd: aPwd },
                        success: function (data) {
                            
                            if (data == "OK") {
                                window.location.href = "Campus.aspx";
                            }
                            else {
                                alert(data);
                            }
                        }
                    })
                }
                else {
                    alert("用户或密码不能为空");
                }
            }),
            $("#Exit").on("click", function () {
                var aUser = $("#username").val();
                var aPwd = $("#password").val();
                if (aUser.length != 0 && aPwd.length != 0) {
                    $.ajax({
                        type: "get",
                        url: "AssetHandel/LoginHandler.ashx",
                        data: { User: aUser, Pwd: aPwd },
                        success: function (data) {
                            if (data == "OK") {
                                alert("已取消");
                                window.location.href = "Login.aspx";
                            }
                            else {
                                alert(data);
                            }
                        }
                    })
                }
            })
        })

    </script>
</head>
<body>
      <div class="container">
            <div class="second">
                <div class="third">
                    <h1>登录</h1>
                    <input id="username" name="name" placeholder="输入用户名..."/>
                    <input id="password" name="id" type="password" placeholder="输入密码..."/>
                </div>
                <div >
                    <input  id="Login" type="button" value="登&nbsp;&nbsp;&nbsp录"/>
                    <input  id="Exit" type="button" value="取&nbsp;&nbsp;&nbsp消"/>
                </div>
            </div>
    </div>
   

</body>
</html>
